package com.example.compont;

import android.graphics.Paint;
import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class TextViewActivity extends AppCompatActivity {

    private TextView tv_4, tv_5, tv_6;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_text_view);
        tv_4 = findViewById(R.id.tv_4);
        tv_4.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
        tv_4.getPaint().setAntiAlias(true);

        tv_5 = findViewById(R.id.tv_5);
        tv_5.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
        tv_5.getPaint().setAntiAlias(true);
        tv_5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                tv_4.setText("这是第一个测试");
            }
        });

        tv_6 = findViewById(R.id.tv_6);
        tv_6.setText(Html.fromHtml("<u>筛选</u>"));
        tv_6.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                tv_4.setText("这是第二个测试");
            }
        });
    }
}